<!DOCTYPE html>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: User
  Date: 2023/6/13
  Time: 10:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<%--
  Created by IntelliJ IDEA.
  User: M
  Date: 2023/6/23
  Time: 11:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.8.6/dist/css/layui.css" rel="stylesheet">
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">

    <!-- 引入 layui.js -->
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
    <style>
        .layui-table-box{
            /*width: 900px;*/
            /*padding-right: 200px;*/
        }
    </style>
</head>
<body>
<div id="addForm" style="display: none;">
    <form class="layui-form layui-form-pane" id="fm" lay-filter="addForm">
        <div class="layui-form-item">
            <label class="layui-form-label">订单id</label>
            <div class="layui-input-block">
                <select name="ocsrId" id="ocsrId"></select>
            </div>
            <label class="layui-form-label">今日生产数量</label>
            <div class="layui-input-block">
                <input type="text" name="producedCount" lay-verify="required" placeholder="今日生产数量" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">生产计划id</label>
            <div class="layui-input-block">
                <select name="productionPlanId" id="productionPlanId"></select>
            </div>
            <label class="layui-form-label">部门</label>
            <div class="layui-input-block">
                <select name="departmentId" id="departmentId"></select>
            </div>
        </div>
        <!-- 其他表单字段 -->
    </form>
</div>
<div class="layui-form layui-border-box layui-table-view" lay-filter="LAY-table-1" lay-id="demo" style=" height:312px;">
    <div class="layui-table-tool">
        <div class="layui-table-tool-temp">
            <div class="layui-btn-container">
                <%--                <button class="layui-btn layui-btn-sm" lay-event="customers" onclick=toAddClass()>--%>
                <%--                    添加</button>--%>
            </div>
        </div>
        <div class="layui-table-tool-self">
            <div class="layui-inline" title="筛选列" lay-event="LAYTABLE_COLS">
                <i class="layui-icon layui-icon-cols"></i>
            </div><div class="layui-inline" title="导出" lay-event="LAYTABLE_EXPORT">
            <i class="layui-icon layui-icon-export"></i></div><div class="layui-inline" title="打印" lay-event="LAYTABLE_PRINT">
            <i class="layui-icon layui-icon-print"></i></div></div></div><div class="layui-table-box"><div class="layui-table-header">
    <table cellspacing="0" cellpadding="0" border="0" class="layui-table"><thead><tr><th data-field="clientId" data-key="1-0-0" class=" layui-unselect">
    </table>
    <table id="demo" lay-filter="test"></table>
</div>
</div>
</div>

<script src="/layui/layui.js"></script>
<script>
    layui.use('table', function() {
        var table = layui.table;
        //第一个实例
        table.render({
            elem: '#demo'
            , height: 312
            , url: 'Product/getQualityAll' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                {field: 'quotationNumber', title: '订单编号', width: 80},
                {field: 'productionPlanId', title: '编号', width: 80},
                {field: 'schedeleCount', title: '计划生产数量', width: 120},
                {field: 'scheduleTime', title: '排班日期', width: 150},
                {field: 'name', title: '尺码', width: 150},
                {field: '', title: '操作', width: 150, toolbar: "#barDemo"},
            ]]
        });
        table.on('tool(test)', function (obj) { // 双击 toolDouble
            var data = obj.data;
            // alert(obj.data.productionPlanId);
            console.log(obj)
            if (obj.event === 'deleteProduct') {
                layer.confirm('真的删除行么', function (index) {
                    $.ajax({
                        "url": "Product/deleteByProductionId",
                        "type": "get",
                        "data": {"productionPlanId": obj.data.productionPlanId},
                        "dataType": "json",
                        // contentType:"application/json;charset=utf-8",
                        "success": function (result) {
                            // layer.msg(result.message);
                            if (result.code == 20000) {
                                table.reload("demo");
                            }
                        },
                        "error": function () {
                            // alert("出错了")
                        }
                    });
                    layer.close(index);
                });
            }
        })
    })
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="deleteProduct">删除</a>
</script>
</body>
</html>